package com.zhht.htzx.ui;

import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.Nullable;

import com.kunminx.architecture.ui.page.DataBindingConfig;
import com.nsgf.library.ui.page.BaseActivity;
import com.nsgf.library.ui.page.StateHolder;
import com.nsgf.library.ui.page.WebViewApiActivity;
import com.zhht.htzx.BR;
import com.zhht.htzx.R;

/**
 * 设置
 */
public class SettleActivity extends BaseActivity {

    private StateHolder mStates;

    @Override
    protected void initViewModel() {
        mStates = getActivityScopeViewModel(StateHolder.class);

    }

    @Override
    protected DataBindingConfig getDataBindingConfig() {
        return new DataBindingConfig(R.layout.activity_settle_info, BR.vm, mStates)
                .addBindingParam(BR.click, new ClickProxy());
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mStates.titleBar.set("设置");
    }


    public class ClickProxy {

        public void openUserInfo() {
            startActivity(new Intent().setClass(SettleActivity.this, UserInfoActivity.class));
        }

        public void openWebView(int type) {

            String title = "";
            if (type == 4)
                title = "关于我们";
            else if (type == 9)
                title = "资质证明";
            else if (type == 5)
                title = "平台规则";
            startActivity(new Intent()
                    .putExtra("id", String.valueOf(type))
                    .putExtra("title", title)
                    .setClass(SettleActivity.this, WebViewApiActivity.class));
        }
    }
}
